<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算测试</title>
    <script src="../../js/jquery-1.11.2.min.js"></script>
    <link href="../../css/bootstrap.css" rel="stylesheet">
</head>
<style>
    [class *=col] {
        /*  background: #CCC;*/
        border: 1px solid #eee;

    }

</style>
<body>
<div class="container-fluid">
    <div class="col-md-3">
        <div class="col-md-6">
            张三
        </div>
        <div class="col-md-6"><input type="text"></div>
    </div>
   <div class="col-md-3">
         <div class="row col-md-6">李四</div>
         <div class="row col-md-6"><input type="text"></div>
     </div>
    <!--  <div class="col-md-3">
        <div class="row col-md-6">21</div>
        <div class="row col-md-6"><input type="text"></div>
    </div>
    <div class="col-md-3">
        <div class="row col-md-6">31</div>
        <div class="row col-md-6"><input type="text"></div>
    </div>-->
</div>
<script>
    $(function () {
        $("input").blur(function () {
            var inputValue = this.value;
            if(inputValue.substring(0,1)==("=")){
              var  inputValue=inputValue.substring(1,inputValue.length);
                var total=eval(inputValue);
                $(this).val(total);
            }
        })
        $("input").focus(function () {
            var inputValue = $.trim(this.value);
            if(inputValue==null||inputValue.length==0){
            }else{
                if(inputValue.substring(0,1)==("=")){
                    $(this).val(inputValue);
                }else{
                    $(this).val("="+inputValue);
                }
            }
        })
    });
</script>
</body>
</html>
